<template>
  <div>
    <div class="box">
      <p>
        <el-button type="primary" @click="login">登陆</el-button>
        <el-button type="primary" @click="query">查询</el-button>
      </p>
      <el-calendar v-model="value" />
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { loginUser, queryUser } from '@/api/user'

export default defineComponent({
  setup() {
    let dk = 234
    console.log(import.meta.env.MODE)
    async function login() {
      let param = {
        loginName: 'admin',
        password: '123',
        platId: '12',
      }
      let data: object = await loginUser(param)
      console.log(data)
      let p1 = new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log('p1')
        }, 1000)
      })
      let p2 = new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log('p2')
        }, 800)
        console.log('p2_2')
      })
      let p3 = new Promise((resolve, reject) => {
        setTimeout(() => {
          console.log('p3')
        }, 2000)
      })
      Promise.all([p1, p2, p3])
    }
    async function query() {
      let param = {
        curPage: 0,
        entId: '',
        loginName: '',
        pageSize: 0,
        password: '',
        platId: '',
        userId: '',
      }
      let data: object = await queryUser(param)
      console.log(data)
    }

    const value = ref(new Date())
    return {
      value,
      login,
      query,
    }
  },
})
</script>

<style scoped lang="less">
.box {
  p {
    text-align: center;
  }
}
</style>
